<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>协议管理</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  #parse('/headFiles.html')
  <link href="$!{resDomain}/assets/simditor-2.3.28z/css/simditor.css" rel="stylesheet" media="all" />
  <style type="text/css">
    .simditor {
      min-height: 700px;
      border: 0;
    }
  </style>
</head>
<body>
<div class="layui-fluid layui-form" wid100>
  <input type="hidden" name="id" value="$!{id}"/>
  <div class="layui-row">
    <div class="layui-col-md8">
      <div class="layui-form-item">
        <label class="layui-form-label">协议标题</label>
        #if($code)
        <input type="hidden" name="code" value="$!{code}"/>
        <div class="layui-form-mid layui-word-aux">$!{title}</div>
        #else
        <div class="layui-input-block">
          <select name="code">
            #foreach($item in $agreementCodeList)
            <option value="$!{item.name()}">$!{item.note()}</option>
            #end
          </select>
        </div>
        #end
      </div>
    </div>
  </div>
  <div class="layui-row">
    <div class="layui-col-md6">
      <div class="layui-form-item">
        <label class="layui-form-label">适用APPID</label>
        <div class="layui-input-block">
          <input type="text" class="layui-input" placeholder="必填项" name="appId" value="$!{appId}">
        </div>
      </div>
    </div>
  </div>
  <div class="layui-form-item">
    <label class="layui-form-label">协议内容</label>
    <div class="layui-input-block">
      <textarea class="form-control" id="editor" name="content">$!{content}</textarea>
    </div>
  </div>
  <div class="layui-form-item layui-hide">
    <input type="button" lay-submit lay-filter="LAY-form-submit" id="LAY-form-submit" value="确认">
  </div>
</div>
#parse('/footFiles.html')
<script src="$!{resDomain}/assets/simditor-2.3.28z/js/module.js"></script>
<script src="$!{resDomain}/assets/simditor-2.3.28z/js/hotkeys.js"></script>
<script src="$!{resDomain}/assets/simditor-2.3.28z/js/uploader.js"></script>
<script src="$!{resDomain}/assets/simditor-2.3.28z/js/simditor.js"></script>
<script>
layui.config({
  base: '$!{webRoot}/layuiadmin/'
  ,webRoot:'$!{webRoot}'
}).extend({
  index: 'lib/index'
}).use(['index', 'form'],function (){
  var key = new Date().getTime();
  new Simditor({
    textarea : $('#editor'),
    toolbar : [ 'title', 'bold', 'italic', 'underline',
      'strikethrough', 'fontScale', 'color', '|', 'ol', 'ul',
      'blockquote', 'code', 'table', '|', 'link', 'image', 'hr',
      '|', 'indent', 'outdent', 'alignment'],
    upload : {
      url : '${resDomain}/file/manage.html?type=image&token=wy&key='+key,
      domain : '${resDomain}',
      callback : function(v,h){
        if(v == 1){
          var self = this;
          $.ajax({
            url : "${resDomain}/file/select/get.do",
            type : "GET",
            dataType : "jsonp", // 返回的数据类型，设置为JSONP方式
            jsonp : 'jsoncallback', //指定一个查询参数名称来覆盖默认的 jsonp 回调参数名 callback
            jsonpCallback: '_get', //设置回调函数名
            data : {key:key},
            success: function(result,status, xhr){
              if(result.code == 200){
                $img = self.createImage('image');
                self.loadImage($img,'${resDomain}' + result.body.filePath);
              }
            }
          });
        }
      }
    }
  });
})
</script>
</body>
</html>